import axios from 'axios';

export function addAppointment(data: any) {
  return axios.post('/api/appointment/add.do', data);
}

export function searchAppointmentByStudentId(studentId: string) {
  return axios.get(`/api/appointment/search.do?studentId=${studentId}`);
}

export function cancelAppointment(data: any) {
  return axios.post('/api/appointment/cancel.do', data);
}

// 获取历史预约记录
export function getHistoryAppointmentsByStudentId(studentId: string) {
  return axios.get(`/api/appointment/history.do?studentId=${studentId}`);
}

// 获取全部预约记录
export function getAllAppointmentsByStudentId(studentId: string) {
  return axios.get(`/api/appointment/all.do?studentId=${studentId}`);
}

// 获取待审核预约列表
export const getPendingAppointments = () => {
  return axios.get('/api/appointment/pending.do');
};

// 审核预约
export const approveAppointment = (appointmentId: number, action: string, reviewerId: number) => {
  return axios.post('/api/appointment/approve.do', {
    appointmentId,
    action,
    reviewerId
  });
};

// 设置优先排队
export const setPriorityAppointment = (appointmentId: number) => {
  return axios.post('/api/appointment/priority.do', {
    appointmentId
  });
}; 